<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>	
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Calendar Sample: Desktop</title>				
		<style type="text/css">
			@import "../themes/claro/Calendar.css";
			@import "calendar.css";
			@import "../../../dojo/resources/dojo.css";
			@import "../../../dijit/themes/dijit.css";
			@import "../../../dijit/themes/claro/claro.css";
			html, body {
				width: 100%;
				height:100%;
			}			
			.dijitCalendar .Highlighted {
				background-color: #fff0b4;
					
			}
			.dijitCalendar .Highlighted .dijitCalendarDateLabel {
				color: red !important;
				border: solid 1px #fff0b4;				
			}					
			
		</style>			
	</head>
	
	<body class="claro">
		<script type="text/javascript" 
				data-dojo-config="async: true, parseOnLoad: true, paths : {'demo' : '../dojox/calendar/tests'}"
 				src="../../../dojo/dojo.js"></script>
		
			<script type="text/javascript">

			require(["dojo/ready", "dojo/_base/lang", "dojo/_base/sniff", "dojo/_base/array", "dojo/_base/fx", "dojo/dom-class", "dojo/on", 
			         "dojo/date/locale", "dojo/parser",	"dojo/dom", "dojo/dom-construct",	"dojo/store/Memory", 
			         "dojo/store/Observable",	"dojox/calendar/Calendar", "dojox/calendar/ColumnView", "dijit/TitlePane", 
			         "dijit/layout/TabContainer", "dijit/layout/ContentPane"],

				function(ready, lang, has, arr, fx, domClass, on, locale, parser, dom, domConstruct,
					Memory, Observable, Calendar){

					ready(function(){
																
						calendar.set("cssClassFunc", function(item){
							// Use custom css class on renderers depending of a parameter (calendar).							
							return item.calendar == "cal1" ? "Calendar1" : "Calendar2"
						});
						
						// Calendar model creation						
						var modelBase = [
							{day: 1, start: [10,0], duration: 1400},
							{day: 2, start: [10,30], duration: 120},
							{day: 2, start: [12,0], duration: 240},
							{day: 3, start: [6,0], duration: 180},
							{day: 3, start: [0,0], duration: 2880, allDay: true}
						];
						
						var someData = [];
												
						var startOfWeek = calendar.floorToWeek(new calendar.dateClassObj());
						
						for (var id=0; id<modelBase.length; id++) {
							var newObj = {
								id: id,
								summary: "New Event " + id,
								startTime: new calendar.dateClassObj(startOfWeek.getTime()),
								endTime: new calendar.dateClassObj(startOfWeek.getTime()),
								calendar: id%2 == 0 ? "cal1" : "cal2",
								allDay: modelBase[id].allDay
							};

							newObj.startTime = calendar.dateModule.add(newObj.startTime, "day", modelBase[id].day);
							newObj.startTime.setHours(modelBase[id].start[0]);
							newObj.startTime.setMinutes(modelBase[id].start[1]);

							newObj.endTime = calendar.dateModule.add(newObj.startTime, "minute", modelBase[id].duration);

							someData.push(newObj);
						}
						
						var store = new Observable(new Memory({data: someData}));
						calendar.set("store", store);
						calendar.set("date", startOfWeek);
												
						// Hide loading panel when application is ready
						fx.fadeOut({
							node:"loadingPanel", 
							onEnd: function(node){
								node.parentNode.removeChild(node)
							}}).play(500);
						

					});
			});
			</script>
			
			<div id="loadingPanel" style="position:absolute;z-index:10;width:100%;height:100%;background:#ffffff">
				<span style="background: #DBEB8F;padding:2px">Loading...</span>
			</div>
			
		    <div data-dojo-type="dijit/layout/TabContainer" style="width:100%;height:100%" tabStrip="true">
				<div data-dojo-type="dijit/layout/ContentPane" title="My first tab" selected="true">
					Lorem ipsum and all around...
				</div>
			    <div data-dojo-type="dijit.layout.ContentPane"  title="Calendar">
			        <div data-dojo-id="calendar" data-dojo-type="dojox.calendar.Calendar"></div>					
			    </div>
			    <div data-dojo-type="dijit.layout.ContentPane"  title="Columns View">
			        <div data-dojo-id="colview" data-dojo-type="dojox.calendar.ColumnView"></div>					
			    </div>
		    </div>		    
		</div>																		
						
	</body>
</html>
